<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVisitorHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('visitorHistory', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('invitedId')->comment('被访公司员工id,employeeInfo表主键')->index();
            $table->integer('cmpId')->comment('所属公司id,cmpInfo表主键')->index();
            $table->integer('visitorTypeId')->comment('所属访客类型id,1:面试,2:客户,3:亲友,4:其他')->index();
            $table->integer('deviceId')->default(0)->comment('所属设备id');
            $table->string('remarkName')->comment('被访问人标记名称');
            $table->string('realName')->comment('访客姓名');
            $table->string('mobile')->comment('访客手机号码');
            $table->string('remarks')->default('')->comment('访客备注');
            $table->tinyInteger('sex')->default(0)->comment('访客性别');
            $table->string('idCard')->default('')->comment('访客身份证');
            $table->string('email')->default('')->comment('访客邮箱');
            $table->string('photo')->default('')->comment('访客头像照片');
            $table->string('company')->default('')->comment('访客公司信息');
            $table->integer('partnerNum')->default(0)->comment('同行人数');
            $table->tinyInteger('status')->comment('访客访问状态,0:待到访,1：已取消,2：已到访,3:未到访');
            $table->tinyInteger('isInvite')->comment('访客来源,0:未被邀请,ipad端登记,1:被邀请,web端邀请');
            $table->integer('visitTime')->comment('创建时间戳');
            $table->integer('planedTime')->default(0)->comment('邀约时间，默认0');
            $table->integer('createdAt')->comment('创建时间');
            $table->integer('updatedAt')->comment('最后更新时间');
        });
        DB::statement("ALTER TABLE `visitorHistory` comment '访客邀请/登记记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('visitorHistory');
    }
}
